<?php
//Zend_Loader::loadFile('../application/admin/models/Template.php');
class Hotelres
{
    /**
     * @var object Zend DB Adapter
     */
    private $_db;
    /**
     * @var string
     */
   
    public function __construct()
    {
			$this->_db = Zend_Registry::get('db');
    }
    
    


    public function gethotellist($hotel_country,$hotel_city,$hotel_title)
    {
    
    	//$command="call gethotellist(".$hotel_country.",".$hotel_country.",".$hotel_title.")";
 //    echo $command;exit;
		//$hotellist = $this->_db->fetchAll($command);
		//print_r($hotellist);exit;
   $sql="";

   if ($hotel_city <>0  && $hotel_country<>0 && $hotel_title<>0)  {   
   	                
        $sql="select * from hotels where hotel_city=".$hotel_city." && hotel_country=".$hotel_country." && hotel_id=".$hotel_title."" ;
    }
    
    if ($hotel_city <>0  && $hotel_country<>0 && $hotel_title==0)  {   
                  
        $sql="select * from hotels where hotel_city=".$hotel_city." and hotel_country=".$hotel_country."" ;
    }
    
      if ($hotel_city <>0  && $hotel_country==0 && $hotel_title==0)  {    
                 
        $sql="select * from hotels where hotel_city=".$hotel_city." " ;
    }
    
      if ($hotel_city <>0  &&  $hotel_country==0 &&  $hotel_title<>0)  {    
      	            
        $sql="select * from hotels where hotel_city=".$hotel_city."  and hotel_id=".$hotel_title."" ;
    }
       if ($hotel_city ==0  &&  $hotel_country<>0 &&  $hotel_title<>0)  {    
      	            
     $sql="select * from hotels where hotel_country=".$hotel_country."  and hotel_id=".$hotel_title."" ;
    }
     if ($hotel_city ==0  &&  $hotel_country<>0 &&  $hotel_title==0)  {    
      	            
        $sql="select * from hotels where hotel_country=".$hotel_country."" ;
    }
    
   //echo $sql;exit;
    $hotellist = $this->_db->fetchAll($sql);

		return $hotellist;
		
        
    }


}

